The present inventive concepts relate to segment cleaning apparatus and methods, and more particularly, to a host which performs segment cleaning applicable to a file system that supports a log-structured file system and related segment cleaning methods.
A log-structured file system has been suggested in a server storage system that uses a hard disk drive. Since the hard disk drive is a device that uses a rotary motor, it has seek latency and rotational latency. Therefore, the log-structured file system configures the entire disk as one log and performs a sequential write operation only. That is, when modifying a file, the log-structured file system does not modify data at the original position. Instead, the log-structured file system adds modified data at the end of the log.
Therefore, the log is continuously extended in one direction. When the log cannot be extended any further as a result of continuous data modification and addition, segment cleaning is performed to return some segments (“victim segments”) included in the log to a free area in which data can be stored. Of blocks included in the victim segments, “live blocks” including valid data are written back at the end of the log. Thus, data is not lost despite the segment cleaning.
One of the operations in the segment cleaning is to select victim segments. As described above, live blocks included in each victim segment should be written back at the end of the log. Therefore, as the number of live blocks included in each victim segment increases, the I/O load of the write-back operation may increase. Hence, a segment which includes a low proportion of live blocks relative to the total number of blocks therein may be selected as a victim segment.